import request from './request.js'

export function getMusicList () {
  return request.get('/top/playlist', {
    params: {
      offset: (Math.random() * 1297).toFixed(0) - 9,
      limit: 9
    }
  })
}
// 获取每日歌曲推荐
export function getRecommendSongsList () {
  return request.get('/recommend/songs')
}

// 获取歌单数据
export function getSongListInfo (songsId) {
  return request.get('playlist/detail', {
    params: {
      id: songsId
    }
  })
}

// 获取歌曲数据
export function getSongListInfoSongs (songsId) {
  return request.get('/song/detail', {
    params: {
      ids: songsId
    }
  })
}

// 获取歌单评论数据
export function getSongListComment (songsId) {
  return request.get('/comment/playlist', {
    params: {
      id: songsId
    }
  })
}

// 评论点赞
export function getCommentLike (songsId, commentId, status, type) {
  return request.post('comment/like', {
    params: {
      id: songsId,
      cid: commentId,
      t: status,
      type: type
    }
  })
}

// 评论点赞
export function sendComment (t, type, songsId, content) {
  return request.post('/comment', {
    params: {
      t: t,
      type: type,
      id: songsId,
      content: content
    }
  })
}

export function getSongsCollector (songsId, offset, limit) {
  return request.get('/playlist/subscribers', {
    params: {
      id: songsId,
      offset: offset,
      limit: limit
    }
  })
}

export function getPrivateContent () {
  return request.get('/personalized/privatecontent')
}

export function getPrivateContentList () {
  return request.get('/personalized/privatecontent/list')
}

export function getNewSong () {
  return request.get('/personalized/newsong')
}

export function getNewSongList (area) {
  return request.get('/top/song', {
    params: {
      type: area
    }
  })
}

export function getNewAlbumList (area, type) {
  return request.get('/top/album', {
    params: {
      area: area,
      type: type
    }
  })
}

export function getNewAlbumDetail (id) {
  return request.get('/album', {
    params: {
      id: id
    }
  })
}

export function getNewAlbumDetailDynamic (id) {
  return request.get('/album/detail/dynamic', {
    params: {
      id: id
    }
  })
}

export function getNewAlbumComment (id) {
  return request.get('/comment/album', {
    params: {
      id: id
    }
  })
}

export function getRecommendMv () {
  return request.get('/personalized/mv')
}
